package com.gravata.enigma.model;

import java.io.Serializable;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName="transponder")
public class Transponder extends EntidadeAbstrata {

	private static final long serialVersionUID = -1516789047244183380L;

	public Transponder() {
	}

	@DatabaseField(generatedId=true,columnName="transponder_id")
	private int id;

	@DatabaseField(canBeNull=false,columnName="frequency")
	private int frequency;

	@DatabaseField(canBeNull=false,columnName="symbolrate")
	private int symbolRate;

	@DatabaseField(canBeNull=false,columnName="polarization",dataType=DataType.ENUM_INTEGER)
	private Polarization polarization;

	@DatabaseField(canBeNull=false,columnName="fec",dataType=DataType.ENUM_INTEGER)
	private FEC fec;

	@DatabaseField(canBeNull=true,columnName="inversion",dataType=DataType.ENUM_INTEGER)
	private Inversao inversion;

	@DatabaseField(canBeNull=true,columnName="flags",dataType=DataType.ENUM_INTEGER)
	private Flags flags;

	@DatabaseField(canBeNull=false,columnName="system",dataType=DataType.ENUM_INTEGER)
	private Sistema system;

	@DatabaseField(canBeNull=true,columnName="modulation",dataType=DataType.ENUM_INTEGER)
	private Modulacao modulation;

	@DatabaseField(canBeNull=true,columnName="rolloff",dataType=DataType.ENUM_INTEGER)
	private Rolloff rolloff;

	@DatabaseField(canBeNull=true,columnName="pilot",dataType=DataType.ENUM_INTEGER,defaultValue="0")
	private Pilot pilot;

	@DatabaseField(canBeNull=true,columnName="onid")
	private int onid;

	@DatabaseField(canBeNull=true,columnName="tsid")
	private int tsid;

	@DatabaseField(canBeNull=false,foreign=true,foreignAutoRefresh=true)
	private Satelite satelite;


	@ForeignCollectionField(eager=false)
	private ForeignCollection<Service> services;

	public Serializable getId() {
		return id;
	}
	public int getFrequency() {
		return frequency;
	}

	public void setFrequency(int frequency) {
		this.frequency = frequency;
	}

	public int getSymbolRate() {
		return symbolRate;
	}

	public void setSymbolRate(int symbolRate) {
		this.symbolRate = symbolRate;
	}

	public Polarization getPolarization() {
		return polarization;
	}

	public void setPolarization(Polarization polarization) {
		this.polarization = polarization;
	}

	public FEC getFec() {
		return fec;
	}
	public void setFec(FEC fec) {
		this.fec = fec;
	}

	public Inversao getInversion() {
		return inversion;
	}
	public void setInversion(Inversao inversion) {
		this.inversion = inversion;
	}

	public Flags getFlags() {
		return flags;
	}
	public void setFlags(Flags flags) {
		this.flags = flags;
	}

	public Sistema getSystem() {
		return system;
	}
	public void setSystem(Sistema system) {
		this.system = system;
	}

	public Modulacao getModulation() {
		return modulation;
	}
	public void setModulation(Modulacao modulation) {
		this.modulation = modulation;
	}

	public Rolloff getRolloff() {
		return rolloff;
	}
	public void setRolloff(Rolloff rolloff) {
		this.rolloff = rolloff;
	}

	public Pilot getPilot() {
		return pilot;
	}
	public void setPilot(Pilot pilot) {
		this.pilot = pilot;
	}

	public Satelite getSatelite() {
		return satelite;
	}

	public void setSatelite(Satelite satelite) {
		this.satelite = satelite;
	}

	public ForeignCollection<Service> getServices() {
		return services;
	}

	public void setServices(ForeignCollection<Service> services) {
		this.services = services;
	}

	public void setOnid(int onid) {
		this.onid = onid;
	}
	public int getOnid() {
		return onid;
	}
	public void setTsid(int tsid) {
		this.tsid = tsid;
	}
	public int getTsid() {
		return tsid;
	}

	@Override
	public String toString() {

		return Integer.toString(frequency/1000)+" "+polarization.getSigla()+" "+Integer.toString(symbolRate/1000) ;

	}

}
